<template>
	<div>
		<el-table :data="paperList" border style="margin-top: 20px;">
			<el-table-column align="center" prop="id" label="编号"></el-table-column>
			<el-table-column align="center" prop="dateTime" label="开考时间"></el-table-column>
			<el-table-column align="center" prop="time" label="考试时间"></el-table-column>
			<el-table-column align="center" prop="paperName" label="试卷名称"></el-table-column>
			<el-table-column align="center" label="考试科目">
				<template slot-scope="scope">
					<el-tag size="medium">{{scope.row.courseName==""? "考试还没开始":scope.row.courseName}}</el-tag>
				</template>
			</el-table-column>
			<el-table-column align="center" label="操作">
				<template slot-scope="scope">
					<el-button v-if="scope.row.isStart==0" disabled>{{考试未开始}}</el-button>
					<el-button v-if="scope.row.isStart==1" @click="GoTest(scope.row.id,scope.row.paperName)">开始考试</el-button>
					<el-button v-if="scope.row.isStart==3">{{查看分数}}</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	export default {
		created() {
			this.getPaper()
		},
		data(){
			return{
				paperList:[]
			}
		},
		methods:{
			// 获取该科目的考卷
			GoTest(id,name){
				this.$router.push({
					path:"/test",
					query:{paper:id,paperName:name}
				})
			},
			getPaper(){
			let courseId = 	this.$route.query.course
				this.request.get("/paper/getCourseByCourseId/"+courseId).then(resp=>{
					this.paperList = resp.data
				})
			}
		}
	}
</script>

<style>
</style>